from playwright.sync_api import Page


class IndexPage:
    def __init__(self, page: Page):
        self.page = page
        self.system_manage = page.get_by_text('系统管理')
        # 不能使用label标签，获取不到该定位
        self.system_manage2 = page.get_by_label('系统管理')
        # self.system_monitor = page.get_by_text('系统监控')
        # self.system_tools = page.get_by_text('系统工具')
        # self.example_demonstration = page.get_by_text('实例演示')

    def navigate(self, url='/index'):
        self.page.goto(url)

    def navigate_system(self):
        self.page.get_by_text("取消").click()
        self.page.get_by_role("link", name="系统管理").click()

    def click_system_manage(self):
        self.system_manage.click()
